package security.Roles;
import java.util.*;


public abstract class Role {

	public abstract String getRoleName();

	public abstract void setRoleName(String roleName);		
	
	public abstract void assignToUser(User user);
	
	public abstract void removeFromUser(User user) ;
	
	public abstract void addPrivilege(Privilege p) ;
	
	public abstract void delPrivilege(Privilege p);

	public abstract Vector<Privilege> getRolePrivileges();

	public abstract void setRolePrivileges(Vector<Privilege> rolePrivileges);
	
	// STATIC METHODS
	// MUST BE OVERWRITTEN BY SUBCLASSES

	public static boolean addRole(Role role) {		
		throwError();
		return false;
	}
	public static boolean saveRole(Role role) {
		throwError();
		return false;
	}
	public static boolean delRole(Role role) {
		throwError();
		return false;
	}
	public static Vector<Role> getRoles() {
		throwError();
		return null;
	}
	public static Role getRoleByName(String roleName) {
		throwError();
		return null;
	}	
	private static void throwError() {
		throw new RuntimeException("Error: use a subclass of Role to call this method");
	}




}
